package org.pumpkin.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;


@Service
public class HelloService {
	@Autowired
	private RestTemplate restTemplate;
	@HystrixCommand(fallbackMethod = "serviceFailure")
	public String hello() {
		return restTemplate.getForEntity("http://CONFIG-CLIENT/hello", String.class).getBody();
	}
	
	public String serviceFailure() {
		return "hello world service is not available !";
	}
}
